package com.tencent.angel.ps;

import com.tencent.angel.ml.matrix.MatrixContext;
import com.tencent.angel.protobuf.generated.MLProtos;
import java.util.List;
import org.apache.hadoop.conf.Configuration;

/**
 * Matrix partitioner interface.
 */
// TODO: 17/6/29 by zmyer
interface Partitioner {
    /**
     * Init matrix partitioner
     *
     * @param mContext matrix context
     *
     */
    void init(MatrixContext mContext, Configuration conf);

    /**
     * Generate the partitions for the matrix
     *
     * @return the partitions for the matrix
     */
    List<MLProtos.Partition> getPartitions();

    /**
     * Assign a matrix partition to a parameter server
     *
     * @param partId matrix partition id
     * @return parameter server index
     */
    int assignPartToServer(int partId);
}
